#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+7;
typedef long long ll;
ll n,a[MAXN],cnt[MAXN],maxn=0,ans=0,tmp=0;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for (int i=1;i<=n;i++){cin >> a[i];cnt[a[i]]++;maxn=max(maxn,a[i]);}
    for (int i=2;i<=maxn;i++){
        if (cnt[i]>=cnt[i-1]+ans)ans=cnt[i];
        else{continue;}
    }
    cout << ans << endl;
    return 0;
}